// 定时刷新ajax及清除定时器
    $(function(){
        setintervalAjax();
        if((starttime*1000) > nowtime){
          clearInterval(timer);
        }else if((endtime*1000) < nowtime){
          clearInterval(timer);
        }else{
          clearInterval(timer); 
          timer = setInterval(setintervalAjax,300);
        }
    })
    
    function  setintervalAjax() {
      
        var url = "http://db2015.wstock.cn/wsDB_API2/stock.php?&symbol="+typenames+"&query=Date,Symbol,SP1,BP1,Name,LastClose,Open,High,Low&u=liyunhe1228&p=liyunhe1228&r_type=2&num=20";
        $.ajax({
            type : "get",
//            async : false, //同步请求
            url : url,
            data : '',
            dataType:'JSON',
            timeout:1000,
            success:function(d){
                //给页面中的当前价位赋值
                if(typeof d == "object"){
                    for(var i = 0;i < d.length;i++){
                        if($.trim($(".buy_"+d[i].Symbol).html()) == '买多'){
                            $("."+d[i].Symbol).find(".price_"+d[i].Symbol).html(d[i].SP1);
                        }else{
                            $("."+d[i].Symbol).find(".price_"+d[i].Symbol).html(d[i].BP1);
                        }
                    }
                }
            }
        })
    }
    
    function fudong(tradeid,buy_status,typename,begin_point) {
        var price = $("#top_"+tradeid).find(".price_FX"+typename).html();
//        var oldfu = $('input[name=fu_'+tradeid+']').val();
        var lastprice = 0;
        if(buy_status == 1){ //卖空
            if (typename == 'XAUUSD') {
                var lastprice = (( parseFloat(begin_point)-parseFloat(price)-parseFloat(1))*10).toFixed(1);
            }else if (typename == 'NYOL20'){
                var lastprice = (( parseFloat(begin_point)-parseFloat(price)-parseFloat(0.1))*100).toFixed(1);
            }else if( typename.indexOf('JPY')>0){
                var lastprice = (( parseFloat(begin_point)-parseFloat(price)-parseFloat(0.1))*100).toFixed(1);
            }else{
                var lastprice = (( parseFloat(begin_point)-parseFloat(price)-parseFloat(0.001))*10000).toFixed(1);
            }
        }else{
            if (typename == 'XAUUSD') {
                var lastprice = ((parseFloat(price) - parseFloat(begin_point)-parseFloat(1))* 10).toFixed(1) ;
            } else if (typename == 'NYOL20'){
                  var lastprice = ((parseFloat(price) - parseFloat(begin_point)-parseFloat(0.1))* 100).toFixed(1);
            }else if( typename.indexOf('JPY')>0){
                  var lastprice = ((parseFloat(price) - parseFloat(begin_point)-parseFloat(0.1))* 100).toFixed(1);
            }else{
                  var lastprice = ((parseFloat(price) - parseFloat(begin_point)-parseFloat(0.001))* 10000).toFixed(1);
            }
        }
//        if(parseFloat(oldfu) < parseFloat(lastprice)){
//            $("#fu_"+tradeid).css('color','green');
//        }else{
//            $("#fu_"+tradeid).css('color','#d72d45');
//        }
        $("#fu_"+tradeid).html(lastprice);
//        $('input[name=fu_'+tradeid+']').val(lastprice);
    }